package hihocoder;
import java.util.ArrayList;
import java.util.Scanner;

/**
 * 
 */

/**
 * @author zhongfang
 *
 */
public class 小Hi小Ho的惊天大作战1 {

	static ArrayList<int[]> allPosibleAns=new ArrayList<>();
	public static void backtrack(int i,int[] s,int A[]) {
		if(i==s.length){//不矛盾，输出
			//检查A[n-1]
			if(A[i-1]==s[i-2]+s[i-1]){
				allPosibleAns.add(s);
			}
			return;
		}
		if(i<2){
			if(s.length>=2){//N>=2
				if(A[0]==0){
					s[0]=0;
					s[1]=0;
					backtrack(2, s, A);
				}
				else if(A[0]==1){
					s[0]=0;
					s[1]=1;
					backtrack(2, s, A);
					int b[]=new int[s.length];
					b[0]=1;
					b[1]=0;
					backtrack(2, b, A);
				}else if (A[0]==2) {
					s[0]=1;
					s[1]=1;
					backtrack(2, s, A);
				}
				return;
			}
			//若N=1，则
			s[0]=A[0];
			allPosibleAns.add(s);
			return;
		}
		if(s[i-1]+s[i-2]==A[i-1]){
			s[i]=0;
			backtrack(i+1, s, A);
		}else if(s[i-1]+s[i-2]+1==A[i-1]){
			s[i]=1;
			backtrack(i+1, s, A);
		}
	}
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner scanner=new Scanner(System.in);
		int taskCount=scanner.nextInt();
		while (taskCount>0) {
			allPosibleAns.clear();
			int N=scanner.nextInt();
			int A[]=new int[N];
			for (int i = 0; i < N; i++) {
				A[i]=scanner.nextInt();
			}
			int[] s=new int[N];
			backtrack(0, s, A);
			int B[]=new int[N];//位置是否是炸弹，1有炸弹，0没有，2不确定,初始化为-1
			for (int i = 0; i < B.length; i++) {
				B[i]=-1;
			}
			for (int[] i : allPosibleAns) {
				for (int j = 0; j < i.length; j++) {
					if(B[j]==2)
						continue;
					if(B[j]==-1){
						B[j]=i[j];
					}else if (B[j]!=i[j]) {//1,-1;-1,1;
						B[j]=2;//如果以前的位置和这一次的位置不一样，则这个位置应该是不确定
					}
				}
			}
			int boomCount=0,noBoom=0;
			for (int i : B) {
				if(i==1){
					boomCount++;
				}else if (i==0) {
					noBoom++;
				}
			}
			StringBuilder boom=new StringBuilder(boomCount+" ");//改为StringBuilder就不超时了。。。。
			StringBuilder noboom=new StringBuilder(noBoom+" ");
			for (int i=0;i<B.length ;i++) {
				if(B[i]==1){
					boom.append(i+1);
					boom.append(' ');
				}else if (B[i]==0) {
					noboom.append(i+1);
					noboom.append(' ');
				}
			}
			boom.deleteCharAt(boom.length()-1);
			System.out.println(boom);
			
			noboom.deleteCharAt(noboom.length()-1);
			System.out.println(noboom);
			taskCount--;
		}
	}

}
